# 常用插件

# 常用配置

# 设置软件启动时选择项目进入,取消关闭确认弹窗

Settings -> Appearacne & Behavior -> System Settings:

  1. 去掉复选框对勾:Confirm before exiting the IDE

  2. 去掉复选框对勾:Reopen projects on startup

# 菜单栏字体和大小

Settings -> Appearacne & Behavior -> Appearance:

  1. 勾选复选框:Use custom font: Microsoft YaHei UI; Size: 14

# 编辑代码的字体和大小

Settings -> Editor -> Font:

  1. Font: Consolas
  2. Size: 16
  3. Line height: 1.2

# 取消字符串严格按照大小写匹配

Settings -> Editor -> General -> Code Completion:

  1. 去掉复选框对勾:Match case:

# 双斜杠注释改为紧跟代码头

Settings -> Editor -> Code Style -> Java -> Code Generation(tab 页签,看不到的话,点击页签最右侧的下三角图标):

  1. 去掉复选框对勾:Line comment at first column
  2. 打上复选框对勾:Add a space at comment start

# CTRL + 鼠标滚轮,改变字体大小(缩放)

Settings -> Editor -> General:

  1. 打上复选框对勾:Change font size (Zoom) with Ctrl+Mouse Wheel

# 优化版本控制(git、svn)的目录颜色展示(idea 低版本)

代码改变时,目录颜色跟着改变

Settings -> Version Control:

  1. 打上复选框对勾:Show directories with changed descendants

# 设置 Project 中间 package 的不折叠(去掉对勾)

image

# 设置 tab 页单行显示

Settings -> Editor -> Editor Tabs:

  1. 以下两个打对勾:Show tabs in:
    1. One row, and if tabs don't fit:
    2. Scroll the tabs panel
  2. 打对勾:Hide tabs if there is no space

# 创建文件时,自动生成作者和时间信息

image

# 显示行号和方法分割线

Settings -> Editor -> Appearance:

  1. Show line numbers
  2. Show method separators

# 显示内存使用情况

View -> Appearance -> Status Bar Widgets -> Memory Indicator(打对勾)

# 快速添加明确的导入包和快速优化导入包(自动帮助删除无用的导入)

Settings -> Editor -> General -> Auto Import:

  1. 打对勾:Add unambiguous imports on the fly
  2. 打对勾:Optimize imports on the fly

# 取消多个导入包import自动合并成 *(设置为999个才合并成 *)

Settings -> Editor -> Code Style -> Java -> Imports(tab页签):

  1. Class count to use import with '*': 999
  2. Names count to use static import with '*': 999

# UTF-8 编码,及 properties 文件 Transparent native-to-ascii conversion

Settings -> Editor -> File Encodings:

  1. Global Encoding: UTF-8
  2. Project Encoding: UTF-8
  3. Default encoding for properties files: UTF-8; 打对勾:Transparent native-to-ascii conversion
  4. Create UTF-8 files: with NO BOM

# Maven deploy 中文乱码

Settings -> Build, Execution, Deployment -> Build Tools -> Maven -> Runner:

  1. VM Options: -Dfile.encoding=GBK

# 打开vue工程时,卡在加载Index(是由于vue工程node_modules下文件太多了)

image

# 设置 JVM 内存大小

Help -> Edit Custom VM Options... -> (idea64.exe.vmoptions 文本编辑) 添加下面一行参数:

-Xmx2048m
1

# 设置 在单元测试中,可以使用 Scanner 使开发者与控制台交互

Help -> Edit Custom VM Options... -> (idea64.exe.vmoptions 文本编辑) 添加下面一行参数:

-Deditable.java.test.console=true
1

# 编写的 *.sh 脚本上传到 Linux 服务器执行报错(由于换行符差异导致)

一般为在 Windows 下用 IDEA 导入项目编译时,默认使用Windows(\r\n)下的文件换行符,而 Unix 类操作系统换行符为 \n,所以 idea 做以下设置:

idea 高版本:Settings -> Editor -> Code Style -> Shell Script: 勾选 Use Unix line separators(\n)

idea 低版本:Settings -> Editor -> Code Style -> Line separator:选择 Unix and MacOs(\n)